home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1998 July
/
EnigmA AMIGA RUN 29 (1998)(G.R. Edizioni)(IT)[!][issue 1998-07 & 08].iso
/
recent
/
warpup1.lha
/
WarpUP-WarpOS
/
Source
/
tools
/
niceppc
/
niceppc.c
next >
Wrap
C/C++ Source or Header
|
1998-03-03
|
1KB
|
47 lines
/* WarpOS tool program which modifies the NICE value of a task
specified by task ID (or the current task if no ID is given)
3.3.1998 by Sam Jordan */
#include <stdio.h>
#include <exec/libraries.h>
#include <dos/rdargs.h>
#include <utility/tagitem.h>
#include <powerpc/tasksppc.h>
#include <clib/dos_protos.h>
#include <clib/powerpc_protos.h>
extern struct Library* PowerPCBase;
struct TaskPPC* taskptr;
char template[] = "ID/K/N,NICE/N";
int* array[2];
struct RDArgs* result;
int initialnice = 0;
void main(void)
{
if (PowerPCBase->lib_Version < 14)
{
printf("Error: powerpc.library V14+ required");
return;
}
if ((result = ReadArgs(template,(LONG *)&array,NULL)) == NULL)
{
printf("Utility to set NICE values. Please specify a task ID and a NICE value.\n");
return;
}
if (array[0])
taskptr = FindTaskByID(*(array[0]));
else
taskptr = FindTaskPPC(NULL);
if (array[1])
initialnice = *(array[1]);
if (taskptr != NULL)
{
SetNiceValue(taskptr,initialnice);
printf("NICE value of task '%s' (ID=%ld) is set to %ld\n",taskptr->tp_Task.tc_Node.ln_Name,taskptr->tp_Id,initialnice);
}
else
printf("Task not found\n");
FreeArgs(result);
}